Images are commonly reproduced in printing systems, typically by including the image data in a Page Description Language (PDL) file format such as Adobe Portable Document Format (PDF) or Microsoft XML Paper Specification (XPS). PDLs, including XPS and PDF, allow one or more user-defined transformations (or transforms) to be applied to the image that allows the image to be positioned and scaled on the page on which the image is to be printed. Where multiple transforms are specified, the PDL interpreter typically multiplies the transformations together to generate a single transform. The resulting transform is usually expressed in floating point precision. The printing of the PDL data file generally involves (1) interpreting the page-specific data described in the PDL data, including images, and (2) converting (also known as rendering) the data to an output raster. The output raster is used by the print engine to mark the page, a process that usually involves the application of ink or toner to a paper print medium.
It is important that the conversion of PDL data to the output raster is efficient to maintain high printing speeds while also minimising the CPU resources required to perform the conversion. CPU resources include the memory (RAM) available to the CPU, the speed that the CPU is able to access the memory (known as bandwidth) and the CPU's processing ability. Image printing is affected by these three resources as each element (or pixel) in the image is stored in memory, accessed and translated in the printing of the image. Where the resolution of the printed image is higher than the resolution of the image data, it is necessary for the renderer to upscale the image. This often involves reading each image pixel multiple times in conjunction with an upscaling algorithm. The upscaling algorithm may simply copy the pixel to the output raster multiple times. More complex upscaling methods may also be used, such as bilinear or bicubic interpolation.
To ensure the high performance and accuracy of the image rendering pipeline in a printing system it is common to perform an inverting operation on the transform that positions the image on the page. The result of the inverting operation is an inverse transform, specified in a floating point format, which maps a position in the output raster to a pixel in the image. While it is possible to use the floating point inverse transform during the rendering process, the operation to map a position in the output raster to a pixel in the image is often performed using integer arithmetic. Traditionally floating point operations have been either slow, or unsupported by processors typically used in renderers. While modern processors can have high performance floating point capability, their integer performance is often much faster and, as a result, techniques pioneered in the early days of computer graphics are equally applicable in modern renderers. The use of a second precision for expressing the inverse transform as an integer allows floating point calculations to be avoided when mapping each pixel of the image.
A difficulty arises when a position in the output raster is mapped to a pixel outside the image using the inverse transform. If not handled correctly, selecting a pixel outside the image will result in either incorrect image data being used or possibly an invalid memory access by the CPU. This situation can occur when calculation errors are introduced in the mapping process. Both the inversion process and the use of two different mathematical precisions lead to small errors when mapping from the raster output to a pixel in the image. If the image is scaled down, the error may be more than one pixel.
A widely used technique developed by early graphics software developers, known as ‘clamping’, may be used to prevent accessing a pixel outside the image. Clamping limits (or ‘clamps’) operate on the selected image pixel coordinate (x,y) so it is always within the image dimensions (w, h) and is achieved using a simple test:
if (x < 0)x = 0;else if (x >= w)x = w−1;if (y < 0)y = 0;else if (y >= h)y = h−1;
A limitation of the algorithm described is that each pixel must be checked, requiring extra operations per pixel when rendering the image and requires branching operations. Both aspects reduce the performance of the image rendering part of the system. A modified version of the algorithm applies the clamping method only to the pixels located at the perimeter of the image.
Ideally the clamping step would be removed altogether to further improve the performance of the rendering system. One technique used in the field involves a step prior to rendering where pixels along the edge of the image in the output raster are determined and mapped back to pixels in the image. Pixels that map to outside the image are then used to adjust the inverse transform such that when the adjusted inverse transform is used by the renderer, only pixels within the image will be accessed. This method removes the need for the renderer to perform clamping, however it requires additional computation to be performed by the PDL interpreter when generating the display list for the renderer.
Ideally the clamping step would be removed completely such that no clamping or coordinate checking is required.